<template>
	<view class="home">
		<view class="home-container">
			<view class="home-header">
				<view class="home-title">小鹿线前端学院</view>
				<view class="home-school">入学信息路口</view>
				<view class="home-show">
					<view class="home-class">
						<text class="show-text" @tap="goShowContrct">查看班级权益</text>
					</view>
					<image src="../../static/home-Img/sousuo2.png" class="home-img" mode=""></image>
				</view>
			</view>
			<scroll-view scroll-y="true" :style="'height: '+clientHeight+'px;'">
				<view class="home-content" :style="'height: '+clientHeight+'px;'">
					<HomeCommdity></HomeCommdity>
				</view>
			</scroll-view>
		</view>
		<MyTabbar :selected='selected'></MyTabbar>
	</view>
</template>

<script>
	import MyTabbar from '../../common/tabbar/my-tabbar.vue'
	import HomeCommdity from '../../compontent/index/HomeCommodity.vue'
	export default {
		data() {
			return {
				selected: 0,
				clientHeight:null,
			}
		},
		methods:{
			goShowContrct(){
				uni.navigateTo({
					url: '../show-contract/show-contract'
				})
			}
		},
		onReady(){
				uni.getSystemInfo({
					success:(res) => {
						// 获取头部的高度 select里面的参数就比如css选择器一样选择元素
						let info = uni.createSelectorQuery().in(this).select('.home-header')
						info.boundingClientRect((data)=> {
							// data包含元素的高度信息:data.height
							// console.log(data)
							
							// 68是tabbar的高度
							this.clientHeight = res.windowHeight - data.height 
						}).exec(function(res){
							// exec这个方法必须执行，即使什么也不做，否则不会获取到信息
						})
					}
				})
		},
		components:{
			MyTabbar,HomeCommdity
		}
	}
</script>

<style>
	/* 隐藏滚动条 */
	scroll-view ::-webkit-scrollbar {
		display: none;
		width: 0 !important;
		height: 0 !important;
	}
	.home.container {
		width: 100%;
		height: 100%;
		margin-right: 7rpx;
		background: url('../../static/home.webp') no-repeat;
		background-size: cover;
		margin-bottom: 120rpx;
		box-sizing: border-box;
	}
	.home-header {
		padding:131rpx 37rpx 10px 37rpx;
	}
	/* 标题 */
	.home-title {
		width: 420rpx;
		height: 59rpx;
		font-weight: 400;
		color: #000CFF;
		font-size: 60rpx;
	}
	/* 入学信息 */
	.home-school {
		width: 236rpx;
		height: 40rpx;
		font-size: 38rpx;
		font-weight: 400;
		line-height: 56rpx;
		color: #909090;
		padding: 30rpx 0;
	}
	/* 查看权益 */
	.home-show {
		width: 270rpx;
		height: 59rpx;
		display: flex;
		align-items: center;
		background-color: #5468ff;
		border-radius: 10rpx;
		box-sizing: border-box;
	}
	.home-class {
		height: 27rpx;
		line-height: 27rpx;
		font-size: 28rpx;
		font-weight: 400;
		color: #fff;
		margin-left: 20rpx;
	}
	.home-class::after {
		content: '';
		width: 1rpx;
		height: 31rpx;
		margin: 0 20rpx;
		border-left: 4rpx solid #fff;
	}
	.home-img {
		width: 30rpx;
		height: 30rpx;
	}
</style>
